package com.huawei.appmarket.service.webview.h5.game;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol.Request;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.appmarket.R;
import com.huawei.fastengine.fastview.download.utils.PackageUtils;
import huawei.widget.HwButton;
import o.azc;
import o.cjk;
import o.cjm;
import o.cjo;
import o.enp;

public class GameH5ErrorActivity extends BaseActivity<GameH5ErrorActivityProtocol> {
    private TextView ˊॱ;
    private View ˏॱ;
    private HwButton ͺ;
    private View ॱˊ;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.game_h5_error);
        this.ॱˊ = findViewById(R.id.title);
        this.ˏॱ = findViewById(R.id.nodata_view);
        this.ͺ = (HwButton) findViewById(R.id.detail_btn);
        this.ˊॱ = (TextView) findViewById(R.id.error_text);
        this.ͺ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ GameH5ErrorActivity ˊ;

            {
                this.ˊ = r1;
            }

            public void onClick(View view) {
                this.ˊ.ˎ(this.ˊ);
            }
        });
        ॱ(getString(R.string.client_app_name));
        ᐝ();
    }

    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
    }

    private void ˎ(Context context) {
        cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
        Request request = new Request();
        request.ˋ("package|com.huawei.gamebox");
        appDetailActivityProtocol.ˏ(request);
        cjk.ˎ().ˋ(context, new cjm("appdetail.activity", appDetailActivityProtocol));
    }

    public void setTitle(CharSequence charSequence) {
        if (charSequence == null || charSequence.toString().trim().length() == 0) {
            charSequence = getString(R.string.client_app_name);
        }
        if (azc.ˎ().ॱ() >= 7) {
            getActionBar().setTitle(charSequence);
        } else {
            ((TextView) findViewById(R.id.detail_title_text)).setText(charSequence);
        }
    }

    private void ᐝ() {
        if (enp.ˎ(this, PackageUtils.HWGAMEBOX_PACKAGE_NAME) == null) {
            this.ˊॱ.setText(R.string.h5_game_not_install);
            this.ͺ.setText(R.string.h5_game_install_lastest_btn);
            return;
        }
        this.ˊॱ.setText(R.string.h5_game_version_invalid);
        this.ͺ.setText(R.string.h5_game_upgrade_lastest_btn);
    }
}
